package com.reservation.dto;

import lombok.Data;

import javax.validation.constraints.*;
import java.math.BigDecimal;

/**
 * 商品请求数据传输对象
 */
@Data
public class ProductRequest {

    @NotBlank(message = "商品名称不能为空")
    @Size(max = 100, message = "商品名称长度不能超过100个字符")
    private String name;

    @NotNull(message = "商品价格不能为空")
    @DecimalMin(value = "0.01", message = "商品价格必须大于0")
    @Digits(integer = 10, fraction = 2, message = "价格格式不正确")
    private BigDecimal price;

    @NotBlank(message = "商品图片不能为空")
    @Size(max = 500, message = "图片URL长度不能超过500个字符")
    private String image;

    @NotNull(message = "库存数量不能为空")
    @Min(value = 0, message = "库存数量不能为负数")
    private Integer stock;

    @Size(max = 500, message = "商品描述长度不能超过500个字符")
    private String description;

    private Boolean isActive = true;
}
